package cn.lovemmd.model.admin.service.impl;

import cn.lovemmd.model.admin.mapper.DownloadLogMapper;
import cn.lovemmd.model.admin.service.DownloadLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
@RequiredArgsConstructor
public class DownloadLogServiceImpl implements DownloadLogService {

    private final DownloadLogMapper downloadLogMapper;

    @Override
    public long getTotalDownloads() {
        return downloadLogMapper.countAll();
    }

    @Override
    public long getDownloadsLast24h() {
        return downloadLogMapper.countLast24h();
    }

    @Override
    public long getDownloadsLast7d() {
        return downloadLogMapper.countLast7d();
    }

    @Override
    public List<Map<String, Object>> getRecentDownloads(int limit) {
        return downloadLogMapper.selectRecentDownloads(limit);
    }
}
